]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
screenShield: Fix user deselection after idle in greeter
authorLukas Schmelting <lschmelting@posteo.com>
Fri, 5 Dec 2025 08:15:33 +0000 (09:15 +0100)
committerMarge Bot <marge-bot@gnome.org>
Wed, 10 Dec 2025 12:02:39 +0000 (12:02 +0000)
When the session goes idle, _maybeCancelDialog() cancels any ongoing
authentication dialog. Commit b16ee1a added code to grab focus after
cancellation, ensuring it stayed on the lock screen curtain rather than
wherever cancel() placed it. This was needed to handle keyboard events
like Enter to raise the unlock dialog.

Commit 727c84251 changed this to grab focus on the dialog itself, since
the lock screen architecture had evolved. However, in the greeter case
there is no separate curtain - the LoginDialog is shown directly and
cancel() already restores focus to the user list via _showUserList().
The additional focus grab on the dialog container moved focus away from
the selected user as soon as the screen began to dim, causing the
username to appear deselected when returning from idle.

Similarly, _ensureUnlockDialog() and _resetLockScreen() grabbed focus on
the dialog container when the screen fully blanked, causing the same
issue.

For the greeter, replace grab_key_focus() with activate(), which
delegates to LoginDialog.activate() and properly focuses the user list.
For the unlock dialog, keep the original grab_key_focus() behavior -
calling UnlockDialog.activate() would invoke _showPrompt(), which would
interfere with commit 4bfa30085 that returns to the clock view after
suspend.

See-also: b16ee1a3a6c02facc803be45d2859e53c906decd
See-also: 727c84251d6e536c5658962b4fd4ec89acdc832f
See-also: 4bfa300850045dcd7c974bdd128adef13f2777b1
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/1132
Closes: https://gitlab.gnome.org/GNOME/gdm/-/issues/599
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3993>

js/ui/screenShield.js

index 65f2e62278bbb31d1068d4bc69ac6c5a2a64aae0..6803d3f0369729ae4ec570cd2d8f769498b4328d 100644 (file)
@@ -188,12 +188,6 @@ export class ScreenShield extends Signals.EventEmitter {
             return;
 
         this._dialog.cancel();
-        if (this._isGreeter) {
-            // LoginDialog.cancel() will grab the key focus
-            // on its own, so ensure it stays on lock screen
-            // instead
-            this._dialog.grab_key_focus();
-        }
     }
 
     _becomeModal() {
@@ -455,7 +449,10 @@ export class ScreenShield extends Signals.EventEmitter {
         }
 
         this._dialog.allowCancel = allowCancel;
-        this._dialog.grab_key_focus();
+        if (this._isGreeter)
+            this._dialog.activate();
+        else
+            this._dialog.grab_key_focus();
         return true;
     }
 
@@ -495,7 +492,10 @@ export class ScreenShield extends Signals.EventEmitter {
             this._lockScreenShown({fadeToBlack, animateFade: false});
         }
 
-        this._dialog.grab_key_focus();
+        if (this._isGreeter)
+            this._dialog.activate();
+        else
+            this._dialog.grab_key_focus();
     }
 
     _lockScreenShown(params) {